<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <h1>Registration Complete</h1>
    <body>
        <?php         
        $fName = trim($_REQUEST['newFName']);
        $mName = trim($_REQUEST['newMName']);
        $lName = trim($_REQUEST['newLName']);
        $add1 = trim($_REQUEST['newAdd1']);
        $add2 =  trim($_REQUEST['newAdd2']);
        $city = trim($_REQUEST['newCity']);
        $state = trim($_REQUEST['newState']);
        $zip = trim($_REQUEST['newZip']);
        $priPho = trim($_REQUEST['newPriPho']);
        $secPho = trim($_REQUEST['newSecPho']);
        $email = trim($_REQUEST['newEmail']);
                
        $username = substr($_POST['newFName'], 0, 1) . substr($_POST['newMName'], 0, 1) .
                    substr($_POST['newLName'], 0, 1) . rand(100, 999);
        
        $insert_sql = "INSERT INTO Student VALUES ('{$username}','{$fName}','{$lName}','{$email}','{$priPho}');";
        mysql_query($insert_sql)
            or die(mysql_error());
        ?>
        
        <p>
            Registration successful.
        </p>
        <p>
            Your username is <?php echo $username ?>. Please create a password using the
            fields below.      
        </p>
        <form>
            <table border="1">
                <tr>
                    <td align="center">Enter Password:</td>
                    <td><input type="password" name="pwPW1"</td>
                </tr>
                <tr>
                    <td align="center">Enter Password Again:</td>
                    <td><input type="password" name="pwPW2"</td>
                </tr>
                <tr>
                    <td><input type="submit" name="pwSubmit" value="Submit" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>
